package thread;

public class SleepDemo03 {
    public static void main(String[] args) {

        Thread thread = new Thread("林永健"){
            public void run(){
                try {
                    System.out.println(getName()+"刚美完容，睡上一觉");
                    Thread.sleep(5000000);
                } catch (InterruptedException e) {
                    System.out.println(getName()+"干嘛呢！干嘛呢！干嘛呢！都破了相了都");
                }
                System.out.println("醒了");
            }
        };
        Thread thread1 = new Thread("黄大锤"){
            public void run(){
                System.out.println(getName()+"大锤八十，小锤四十");
                for (int i = 0; i < 5; i++) {
                    System.out.println(getName()+"八十！");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                thread.interrupt();//中断该线程
            }
        };
        thread.start();
//        thread.setPriority(10);
        thread1.start();
    }
}
